Back

Contents

Elasticsearch cheat sheet

Indexes

Insert new index

PUT <ip>:<port>/path/to/api/<index_name>

where ip, port and the /path/to/api define the FQDN of the service, and index_name is the name of the index to be created.

Insert new document in an index

PUT <ip>:<port>/path/to/api/<index_name>/_doc/<id>

where id is an arbitary document id.

Request body is a JSON document, e.g.

{
    "key": "value"
}

Get the mapping of an index

Useful to get document field types etc.

GET <ip>:<port>/path/to/api/<index_name>/_mapping

Delete an index

DEL <ip>:<port>/path/to/api/<index_name>

Top